@extends('admin.layout')

@section('title',$title)

@section('content')
<!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                Data Tables
                <small>advanced tables
                @if(session('info'))
                    <span id='info' class="text-red"> {{session('info')}}</span>
                @endif
                </small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
                <li><a href="#">Tables</a></li>
                <li class="active">Data tables</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    

                    <div class="box">
                        <div class="box-header">
                            <h3 class="box-title">订单列表</h3>
                        </div><!-- /.box-header -->
                        <div class="box-body">

                            <table id="example1" class="table table-bordered table-striped">
                                <form action="{{ url('/admin/order') }}">

                                <div class="row">
                                    <div class="col-md-2">
                                        <!-- select -->
                                        <div class="form-group">
                                            <select name="num" class="form-control">
                                                    <option 
                                                        @if(!empty($request['num']) && 
                                                        $request['num'] == 10)
                                                            selected="selected"
                                                        @endif>10
                                                    </option>
                                                    <option
                                                        @if(!empty($request['num']) && $request['num'] == 20)
                                                            selected="selected"
                                                        @endif>20
                                                    </option>
                                                    <option
                                                        @if(!empty($request['num']) && $request['num'] == 50)
                                                            selected="selected"
                                                        @endif>50
                                                    </option>
                                                    <option
                                                        @if(!empty($request['num']) && $request['num'] == 100)
                                                            selected="selected"
                                                        @endif>100
                                                    </option>
                                                </select>
                                        </div>
                                    </div>
                                    <div class="col-md-4 col-md-offset-6">
                                        <div class="input-group input-group">
                                            <input name="keywords" value="{{ $request['keywords'] or ''}}" type="text" class="form-control">
                                        <span class="input-group-btn">
                                            <button class="btn btn-info btn-flat" type="submit">搜索</button>
                                        </span>
                                        </div>
                                    </div>
                                </div>
                                </form>

                                <thead>
                                <tr>
                                    <th>ID号</th>
                                    <th>订单号</th>
                                    <th>收货人</th>
                                    <th>联系电话</th>
                                    <th>订单状态</th>
                                    <th>下单时间</th>
                                    <th>操作</th>
                                </tr>
                    @foreach($data as $row)
                                <tr>
                                    <th>{{$row -> id}}</th>
                                    <th>{{$row -> oid}}</th>
                                    <th>{{$row -> rec}}</th>
                                    <th>{{$row -> tel}}</th>
                                    <th>@if($row -> status == 0)
                                       未付款  
                                    @elseif($row -> status ==1)
                                        已付款,未发货
                                    @elseif($row -> status ==2)
                                        未收货
                                    @elseif($row -> status ==3)
                                        已收货
                                    @else
                                        交易完成
                                    @endif</th>
                                    <th>{{$row -> created_at}}</th>
                                    <th><a href="{{url('/admin/order/delete')}}/{{$row -> oid}}">删除</a> | <a href="{{url('/admin/order/send')}}/{{$row -> oid}}">发货</a> | <a href="{{url('/admin/order/info')}}/{{$row -> oid}}">详情</a></th>
                                </tr>
                    @endforeach
                                </thead>
                                <tbody>
                                
                                </tbody>
                            </table>
                           {{ $data -> appends($request) ->links() }}
                        </div><!-- /.box-body -->
                    </div><!-- /.box -->
                </div><!-- /.col -->
            </div><!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
    <script type="text/javascript">

        function doDel(id)
            {
                
               
                var delForm = document.getElementById('delForm');
                delForm.action = "{{ url('/admin/category') }}" + '/' + id;
                delForm.submit();
            }
        window.onload = function()
        {   

            
        }

       
        $('#info').fadeOut(1000);
    </script>
@endsection('content')